import random
import math

class Action:
	
	R = 0
	G = 1
	B = 2
	Y = 3
	WRONG = 4
	
	def __init__(self):
		self.actionStack = list()
	
	def pickRandomAction(self): #Returns a random number between 1 and 4
		return math.floor(4*random.random())
		
	def clearActions(self): #Empties the actionStack
		self.actionStack = list()
		
	def addAction(self, action): #Adds the specified action to the actionStack
		self.actionStack.append(action)
		
	def addRandomAction(self): #Adds a random Action to the actionStack, and returns the action
		action = self.pickRandomAction()
		self.actionStack.append(action)
		return action
		
	def setActionStack(self, actionStack): #Sets the action stack to the specified list
		self.actionStack = actionStack
		
	def compareActions(self, myActionStack): #Comapres the two sequences of actions up to the length of the shortest list
		i = 0
		if len(self.actionStack) < len(myActionStack.actionStack):
			for action in self.actionStack:
				if action != myActionStack.actionStack[i]:
					return False
				i = i + 1
		elif len(myActionStack.actionStack) < len(self.actionStack):
			for action in myActionStack.actionStack:
				if action != self.actionStack[i]:
					return False
				i = i + 1
		else:
			if self.actionStack == myActionStack.actionStack:
				return True
			else:
				return False
		return True